<?php
declare (strict_types = 1);

namespace app\admin\controller;

use app\admin\BaseController;
use think\facade\Db;
use think\facade\View;

class Index extends BaseController
{
    public function index()
    {
        $menu = get_admin_menus();
        View::assign('menu', $menu);
        return View();
    }

    public function main()
    {
        $adminCount=Db::name('admin')->where('status','1')->count();
        $userCount=Db::name('user')->where('status','1')->count();
        $articleCount=Db::name('article')->where('status','1')->count();
        $install=false;
        if (file_exists(CMS_ROOT . 'app/install')) {
            $install=true;
        }
        View::assign('adminCount', $adminCount);
        View::assign('userCount', $userCount);
        View::assign('articleCount', $articleCount);
        View::assign('install', $install);
        return View();
    }

    public function errorShow()
    {
        echo '错误';
    }
    
}
